package model;

import java.io.Serializable;
import java.util.ArrayList;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;


@XmlRootElement(name = "lectureRoom")
public class LectureRoom extends Link implements Serializable
{
	private static final long serialVersionUID = 1979683536157155268L;

	private static int i = 0;
	
	@XmlAttribute
	private String id = "";
	
	@XmlAttribute
	private String name = "";
	
	@XmlAttribute
	private String capacity = "";
	
	@XmlAttribute
	private String type = "";
	
	@XmlAttribute
	private String unit = "";
	
	@XmlElement(name = "day")
	private ArrayList<Day> days = new ArrayList<Day>();
	
	public LectureRoom() {}
	
	public LectureRoom(String name)
	{
		i++;
		this.id = i + "";
		this.name = name;
	}
	
	public LectureRoom(String name, String capacity, String type, String unit)
	{
		i++;
		this.id = i + "";
		this.name = name;
		this.capacity = capacity;
		this.type = type;
		this.unit = unit;
	}
	
	public String toString()
	{
		String out = "\n";
		for (int i = 0; i < days.size(); i++)
		{
			out += days.get(i) + "\n";
		}
		return "Lecture room id(" + id + ") -> Name: " + name + " | Capacity: " + capacity + " | Type: " + type + " | Unit: " + unit + out;
	}
	
	public Day createDay(String name)
	{
		Day day = new Day(name);
		days.add(day);
		return day;
	}

	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public String getCapacity()
	{
		return capacity;
	}

	public String getType()
	{
		return type;
	}

	public String getUnit()
	{
		return unit;
	}

	public ArrayList<Day> getDays()
	{
		return days;
	}
}
